<template>
  <!--验证detailInfo对象不为空-->
  <div class="goods-info" v-if="Object.keys(detailInfo).length !== 0">
    <div class="info-desc">
      <hr class="desc-hr">
      <div class="desc">{{ detailInfo.desc }}</div>
      <hr class="desc-hr2">
    </div>


    <div v-for="item in detailInfo.detailImage">

      <div class="info-key">{{ detailInfo.detailImage[0].key }}</div>
      <div class="info-list">
        <img v-for="item in imgs" :src="item" @load="imgLoad" alt="">
      </div>

    </div>

  </div>
</template>

<script>
  export default {
    name: "",
    data(){
      return {
        imgs: [],
        counter: 0
      }
    },
    created(){
      for(let i=1; i<13; i++){
        let temp = require("assets/img/home/sell/"+ i +".webp")
        this.imgs.push(temp)
      }
    },
    props: {
      detailInfo: {
        type: Object,
        default(){
          return {}
        }
      }
    },
    methods: {
      imgLoad(){
        if(++this.counter === 12){
          this.$emit('imageLoad')
        }
      }
    }
  }
</script>

<style lang="less" scoped>
  .goods-info{

  }
  .desc-hr{
    width: 100px;
    margin-bottom: 20px;
  }
  .desc-hr2{
    width: 100px;
    position: absolute;
    right: 0;
    margin-top: 20px;
  }
  .info-desc,.info-key{
    margin: 25px 16px;
    position: relative;
  }
  .info-desc{
    /*padding: 20px 10px;*/
  }
  .info-desc::before{
    content: '';
    height: 6px;
    width: 6px;
    background-color: black;
    position: absolute;
    left: 0;
    top: -5px;
  }
  .info-desc::after{
    content: '';
    height: 6px;
    width: 6px;
    background-color: black;
    position: absolute;
    right: 0;
    bottom: -21px;
  }
  .info-key{
    font-weight: bold;
    margin: 12px 16px;
  }
  .info-list img{
    display: block;
    width: 100%;
    margin-top: 4px;
  }
</style>
